package com.doujiao.auth.controller;

import com.doujiao.auth.config.RequiresPermission;
import com.doujiao.core.Result;
import com.doujiao.core.auth.entity.AdminMenu;
import com.doujiao.auth.service.AdminMenuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import jakarta.annotation.Resource;

/**
 * <p>
 * 菜单管理控制器
 * </p>
 *
 * @author wuyunbin
 * @since 2025-05-24
 */
@Tag(name = "菜单管理")
@RestController
@RequestMapping("/adminMenu")
public class AdminMenuController {

    @Resource
    private AdminMenuService adminMenuService;

    /**
     * 获取菜单树形结构
     * @return 菜单树
     */
    @Operation(summary = "获取菜单树形结构")
    @RequiresPermission("menu:query")
    @GetMapping("/tree")
    public Result<List<AdminMenu>> getMenuTree() {

        return Result.success(adminMenuService.getMenuTree());
    }
}
